package com.company;

import javax.swing.*;


public class MainWindow extends JFrame {
	Plansza p = null;

	public MainWindow() {
		super( "Saper" );
		this.setDefaultCloseOperation( WindowConstants.EXIT_ON_CLOSE );
		this.setSize( 400, 400 );
		this.setLocationRelativeTo( null );
		int boardSize = 10;
		int liczbaMin = 15;
		createNewGame( boardSize, liczbaMin );
		this.setVisible( true );
	}


	private void createNewGame( int boardSize, int liczbaMin ) {
		if ( p != null )
			this.remove( p );
		p = new Plansza( this, boardSize, liczbaMin );
		this.add( p );
		p.initializeNewGame();
	}
}
